package entity

import (
	"time"

	"github.com/jinzhu/gorm"
	log "github.com/sirupsen/logrus"
	"shqsoft.cn/pasnj/base"
)

//中收
type InCollect struct {
	ID      int        `gorm:"AUTO_INCREMENT;primary_key;column:ID"`
	RQ      *time.Time `gorm:"column:RQ"`
	ZZJGDM  string     `gorm:"column:ZZJGDM"`
	ZL      string     `gorm:"column:ZL"`
	KH      string     `gorm:"column:KH"`
	ORGNAME string     `gorm:"column:ORGNAME"`
	NAME    string     `gorm:"column:NAME"`
	ZB      string     `gorm:"column:ZB"`
	BZ      string     `gorm:"column:BZ"`
	JE      string     `gorm:"column:JE"`
	SY      string     `gorm:"column:SY"`
	ZSL     float64    `gorm:"column:ZSL"`
	ZRMSH   float64    `gorm:"column:ZRMSH"`
}

//TableName 中收
func (InCollect) TableName() string {
	return "T_BASE_GJ_ZS"
}

//导入后执行分户处理
func JxkhZSAfterImport(tx *gorm.DB, params map[string]string) (err error) {
	tx.Exec("EXEC UP_BASE_GJ_ZS")
	log.Debug("成功！")
	return nil
}

func InCollectEF() base.EntityFunc {
	return func() interface{} {
		entity := InCollect{}
		return &entity
	}
}
func InCollectESF() base.EntitiesFunc {
	return func() interface{} {
		var entities []InCollect
		return &entities
	}
}

func init() {
	base.DaoPoolObj.Put("InCollect", base.NewDefaultDao(InCollectEF(), InCollectESF(), nil))
	base.SetAfterCallBack("InCollect", JxkhZSAfterImport)
}
